<template>
  <div class="container">
      <manylayerattribute :landarrtibutes="propertiesarry" v-show="showattribute"></manylayerattribute>
      <changstyle :editlayername="layername" v-show="showstyle"></changstyle>

  </div>
</template>

<script>
  import manylayerattribute from "./components/manylayerattribute";
  import changstyle from "./components/change-style";
  import Map from 'ol/Map.js';
  import View from 'ol/View.js';
  import {FullScreen,ScaleLine, defaults as defaultControls} from 'ol/control';
  import Draw from 'ol/interaction/Draw';
  import Feature from 'ol/Feature';
  import VectorSource from 'ol/source/Vector';
  import {Vector as VectorLayer} from 'ol/layer';
  import {Icon, Style,Text,Circle as CircleStyle} from 'ol/style';
  import GeoJSON from 'ol/format/GeoJSON';
  import {WFS} from 'ol/format';
  import {Fill, Stroke} from 'ol/style';
  import Projection from "ol/proj/Projection";
  import {defaults} from 'ol/control.js';
  import {getWidth, getTopLeft} from 'ol/extent.js';
  import TileLayer from 'ol/layer/Tile.js';
  import TileWMS from 'ol/source/TileWMS';
  import WMTS from 'ol/source/WMTS.js';
  import WMTSTileGrid from 'ol/tilegrid/WMTS.js';
  import MousePosition from 'ol/control/MousePosition';
  import {createStringXY} from 'ol/coordinate';
  import PluggableMap from 'ol/PluggableMap';
  import {getVectorContext} from 'ol/render';
  import {sortFeature} from "../../utils/map/countFeaturestype";
  import {getLayerStyle} from "../../api/cydtRequest";
  import XYZ from "ol/source/XYZ"
  import {
    and as andFilter,
    equalTo as equalToFilter,
    like as likeFilter,
    intersects as intersectsFilter,
    or as orFilter
  } from 'ol/format/filter';
  import axios from "axios";
  import bus from "../../assets/js/eventBus"
  import { register } from 'ol/proj/proj4';
  import proj4 from 'proj4';
  export default {
    name: "oneMap",
    components: {
      manylayerattribute,
      changstyle,

    },
    props:['changepage'],
    data(){
      return{
        propertiesarry2:[],
        propertiesarry:[],
        showattribute:true,
        showstyle:false,
        layername:"",

      }
    },
    created(){

    },
    watch: {

      changepage(newV,oldV){
          console.log(newV)
          if(newV.btnum==1){
              console.log(111111)
              this.showattribute = false;
              this.showstyle = true;
          }else {
              this.showattribute = true;
              this.showstyle = false;
          }

      }
    },


    mounted() {
      let that=this;
      bus.$on("propertieItems", (data) => {
          //console.log('data')
          that.propertiesarry = data;
      });
      bus.$on("editstatus", (data) => {
          if(data==true){
              that.showattribute = false;
              that.showstyle = true;
              bus.$on("layername", (data) => {
                  that.layername = data;
                  console.log('data')
                  console.log(that.layername)
              });
          }else {
              that.showattribute = true;
              that.showstyle = false;
          }
      });


    },
    methods:{



    }
  }
</script>

<style >
  @import 'myMap.scss';
</style>
